<?php
/**
 * A submit button
 *
 *
 */
class submit extends input
{

    function submit($id=NULL, $value=NULL, $class=NULL, $label=NULL)
    {
        parent::input($id, "submit", $class, $label);
        $this->setValue($value);
    }

    public function isClicked()
    {
        $id = $this->id;
        $value = strtolower(urldecode($this->value));
        if (strtolower($_REQUEST[$id]) == $value )
        {
            return true;
        }
        else
        {
            return false;
        }
    }

    public function onClick($function, $options=NULL)
    {
        if ( $this->isClicked() )
        {
            if (function_exists($function))
            {
                call_user_func($function, $options);
            }
        }
    }

}
?>